using NodeCanvas.Framework;
using UnityEngine;
using Yoozoo.Gameplay.Liberty.StreetEvent;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    public class NpcIsNearCup : AIConditionBaseNode
    {
        public float DistanceToCup = 20;
        public BBParameter<Vector3> TargetPosition;
        protected override bool OnCheck()
        {
            var cupTrans = StreetFightEvent.Instance.GetCup();
            if (cupTrans != null)
            {
                if (Vector3.Distance(cupTrans.transform.position,_entity.data.position) <= DistanceToCup)
                {
                    TargetPosition.value = cupTrans.position;
                    return true;
                }
            }
            return false;
        }
    }
}